<template>
    <div class="box">
          <div class="header">
            <van-nav-bar title="首页" />
          </div>
          <div class="content">
              <ul>
                 <li v-for="item in list" :key="item.id" @click="$router.push('/detail/'+item.id)">
                     <div><img :src="item.image" alt=""></div>
                     <div>
                         <p  class="van-multi-ellipsis--l2">{{item.title}}</p>
                         <p>￥{{item.price}}</p>
                     </div>
                 </li>
              </ul>
          </div>
         </div>
</template>

<script setup >
import {ref,onMounted} from 'vue'
import request from '@/utils/request'
const list =ref([])
onMounted(()=>{
    request.get('/list').then(res=>{
        if(res.data.code==200)
        {
          list.value=res.data.data
        }
    })
})
</script>
<style lang="scss" >
ul{
    column-count: 2;
    column-gap: 10px;
    li{
        break-inside: avoid;
        img{
            width: 100%;
        }
    }
}
</style>